VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Port"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Private WithEvents sActivator As shpActivator
Attribute sActivator.VB_VarHelpID = -1
Private WithEvents sEvent As shpEvent
Attribute sEvent.VB_VarHelpID = -1
Private WithEvents sInput As shpInput
Attribute sInput.VB_VarHelpID = -1
Private WithEvents sOutput As shpOutput
Attribute sOutput.VB_VarHelpID = -1
Private Shape As Object

Public Event Move(ByVal X As Double, ByVal Y As Double)
Public Event Destruct()

Property Get X() As Double
    X = Shape.nLeft
    If Not Shape.Parent Is Nothing Then
        X = X + Shape.Parent.nLeft
    End If
End Property

Property Get Y() As Double
    Y = Shape.nTop
    If Not Shape.Parent Is Nothing Then
        Y = Y + Shape.Parent.nTop
    End If
End Property

Property Get Index() As Long
    Index = Shape.Index
End Property

Property Let Index(ind As Long)
    Shape.Index = ind
End Property

Property Get Parent() As Object
    Set Parent = Shape.Parent
End Property

Property Let Parent(par As Object)
    Shape.Parent = par
End Property

Property Get Link() As Object
    Set Link = Shape.Link
End Property

Property Let Link(lin As Object)
    Shape.Link = lin
End Property

Property Get nLeft() As Double
    nLeft = Shape.nLeft
End Property

Property Get nTop() As Double
    nTop = Shape.nTop
End Property

Property Get Object() As Object
    Set Object = Shape
End Property

Public Sub Position(ByVal lef As Double, ByVal top As Double)
    If lef > 0 Then
        Shape.nLeft = lef
    Else
        Shape.nLeft = 0
    End If
    If top > 0 Then
        Shape.nTop = top
    Else
        Shape.nTop = 0
    End If
    Move
End Sub

Public Sub Move()
    RaiseEvent Move(Shape.nLeft, Shape.nTop)
End Sub

'Public Sub Terminate()
'    RaiseEvent Terminate
'End Sub

Public Sub Focus(Optional flg As Boolean = True)
    Shape.Focus flg
End Sub

Public Function Init(ByRef shp As Object) As Boolean
    Select Case True
        Case TypeOf shp Is shpActivator
            Set sActivator = shp
        Case TypeOf shp Is shpEvent
            Set sEvent = shp
        Case TypeOf shp Is shpInput
            Set sInput = shp
        Case TypeOf shp Is shpOutput
            Set sOutput = shp
    End Select
    Set Shape = shp
    Init = True
End Function

Private Sub sActivator_Move(ByVal X As Double, ByVal Y As Double)
    RaiseEvent Move(X, Y)
End Sub

Private Sub sEvent_Move(ByVal X As Double, ByVal Y As Double)
    RaiseEvent Move(X, Y)
End Sub

Private Sub sInput_Move(ByVal X As Double, ByVal Y As Double)
    RaiseEvent Move(X, Y)
End Sub

Private Sub sOutput_Move(ByVal X As Double, ByVal Y As Double)
    RaiseEvent Move(X, Y)
End Sub

Private Sub sActivator_Destruct()
    RaiseEvent Destruct
End Sub

Private Sub sEvent_Destruct()
    RaiseEvent Destruct
End Sub

Private Sub sInput_Destruct()
    RaiseEvent Destruct
End Sub

Private Sub sOutput_Destruct()
    RaiseEvent Destruct
End Sub

